<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
       .box{
        width: 180px;
        height: 200px;
        background-color: aqua;
        margin: 10px 10px;
        cursor: pointer;

       }
    </style>
</head>
<body>
    <div class="box">

    </div>
    <script>
     let box=document.querySelector(".box")
   console.log(box.offsetLeft);
   box.addEventListener('mousemove', function(e){
               
            // console.log(e.pageX);
            // console.log(e.pageY);
            // console.log(this.offsetLeft);
            let x=e.pageX - this.offsetLeft;
            let y=e.pageY - this.offsetTop;
            console.log(x,y);
            this.innerHTML = 'X坐标是'+x+'y坐标是'+y
   })




    </script>
</body>
</html>